'use strict';
var Schema = require('mongoose').Schema,
    CommonEnum = require('../controllers/Enum.js'),
    Model = require('../../../Base/server/controllers/Model');

var modelField = {
    Code: {
        type: String,
        trim: true,
        Name: '编码',
        IsUnique: true,
        IsEmpty: false        
    },
    Name: {
        type: String,
        Name: '名称',
        IsEmpty: false,
        trim: true
    },
    Years: {
        type: Number,
        Name: '年数',
        default: 0
    },
    Months: {
        type: Number,
        Name: '月数',
        default: 0
    },
    Days: {
        type: Number,
        Name: '天数',
        default: 0
    },
    Hours: {
        type: Number,
        Name: '小时数',
        default: 0
    },
    Minutes: {
        type: Number,
        Name: '分钟数',
        default: 0
    },
    Seconds: {
        type: Number,
        Name: '秒数',
        default: 0
    },
    FirstTime: {
        type: Date,
        Name: '首次执行时间',
        IsEmpty: false
    },
    EndMode: {
        type: Number,
        Name: '结束方式',
        IsEmpty: false,
        Enum: CommonEnum.EndMode
    },
    EndTime: {
        type: Date,
        Name: '结束时间'
    },
    RepeatTimes: {
        type: Number,
        Name: '重复次数'
    },
    IsSystem: {
        type: Boolean,
        Name: '系统预置'
    },
    Remark: {
        type: String,
        Name: '备注',
        default: '',
        trim: true
    }
};

var newModel = new Model(modelField);
newModel.addIndex({Name: 1});
newModel.addIndex({Code: 1});
newModel.create('ScheduleProgram', '调度方案');
